﻿using System;
using System.Collections.Generic;
using System.Text;

namespace RexToy.Cassandra
{
    class UTF8Type : IMarshal
    {
        public byte[] GetBytes(object data)
        {
            if (data == null)
                return Constant.Zero_Length_Byte_Array;
            string str = (string)data;
            return Encoding.UTF8.GetBytes(str);
        }

        public object GetData(byte[] bytes)
        {
            return Encoding.UTF8.GetString(bytes);
        }
    }
}
